knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data$ivotd, data$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
plot <- p[["rdplot"]]
plot.formated <-plot +geom_vline(xintercept=c(-0.8,0.8), linetype="dotted") +
theme(text=element_text(size=12),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
plot.title = element_blank(),
legend.position = "bottom")
plot.formated
ggsave(filename="../Results/Figures/Figure 2.pdf", plot=plot.formated, device="pdf",
height=5, width=5, units="in", dpi=250, bg = "transparent")
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
data.dhole <-subset(data, z != 0 | is.na(z))
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data$ivotd, data$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
plot <- p[["rdplot"]]
plot.formated <-plot +geom_vline(xintercept=c(-0.8,0.8), linetype="dotted") +
theme(text=element_text(size=12),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
plot.title = element_blank(),
legend.position = "bottom")
plot.formated
ggsave(filename="../Results/Figures/Figure 2.pdf", plot=plot.formated, device="pdf",
height=5, width=5, units="in", dpi=250, bg = "transparent")
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data.dhole$ivotd, data.dhole$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
plot <- p[["rdplot"]]
plot.formated <-plot +geom_vline(xintercept=c(-0.8,0.8), linetype="dotted") +
theme(text=element_text(size=12),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
plot.title = element_blank(),
legend.position = "bottom")
plot.formated
ggsave(filename="../Results/Figures/Figure 2 dhole.pdf", plot=plot.formated, device="pdf",
height=5, width=5, units="in", dpi=250, bg = "transparent")
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data$ivotd, data$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
plot <- p[["rdplot"]]
plot.formated <-plot +geom_vline(xintercept=c(-0.8,0.8), linetype="dotted") +
theme(text=element_text(size=12),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
plot.title = element_blank(),
legend.position = "bottom")
plot.formated
ggsave(filename="../Results/Figures/Figure 2.pdf", plot=plot.formated, device="pdf",
height=5, width=5, units="in", dpi=250, bg = "transparent")
knitr::opts_chunk$set(echo = TRUE)
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data$ivotd, data$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data$ivotd, data$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
plot <- p[["rdplot"]]
plot.formated <-plot +geom_vline(xintercept=c(-0.8,0.8), linetype="dotted") +
theme(text=element_text(size=12),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
plot.title = element_blank(),
legend.position = "bottom")
plot.formated
ggsave(filename="../Results/Figures/Figure 2.pdf", plot=plot.formated, device="pdf",
height=5, width=5, units="in", dpi=250, bg = "transparent")
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
knitr::opts_chunk$set(echo = TRUE)
library(rmarkdown)
library(haven)
library(rdrobust)
library(ggplot2)
data <- read_dta("../Data/BM_PA.dta")
## Figure 2: RD effect for the turnout intention (0.8 window)
p <- rdplot(data$ivotd, data$z, h=0.8, p=0, binselect = "qsmv", kernel = "uniform", x.lim = c( -2.6, 2.6), y.lim = c(0.5, 1.00), y.label= "Turnout intention", x.label= "Running variable: days to the publication of Poll 1", col.lines = "#6A1B2E",  col.dots="black")
plot <- p[["rdplot"]]
plot.formated <-plot +geom_vline(xintercept=c(-0.8,0.8), linetype="dotted") +
theme(text=element_text(size=12),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
plot.title = element_blank(),
legend.position = "bottom")
plot.formated
ggsave(filename="../Results/Figures/Figure 2.pdf", plot=plot.formated, device="pdf",
height=5, width=5, units="in", dpi=250, bg = "transparent")
